package com.shangjinrong.controller.admin;

import com.shangjinrong.domain.LendItem;
import com.shangjinrong.result.R;
import com.shangjinrong.service.LendItemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author Naruto
 */

@RestController
@CrossOrigin
@RequestMapping("admin/lendItem")
public class AdminLendItemController {


    @Autowired
    private LendItemService lendItemService;


    /**
     * 根据标的id返回该标的的所有投资列表
     *
     * @param lendId 标的id
     * @return 返回该标的的投资列表
     */
    @GetMapping("list/{lendId}")
    public R list(@PathVariable Long lendId) {
        List<LendItem> lendItemList = lendItemService.selectByLendId(lendId);

        return R.ok().data("lendItemList", lendItemList);
    }
}
